﻿CREATE TABLE DBOrderService.DBOrder (
	ID					uniqueidentifier PRIMARY KEY,							/* Unique GUID for this order */
	DBOrderServiceID	uniqueidentifier NOT NULL,								/* is under this order service*/
	DBInstrumentStaticDataID		uniqueidentifier NOT NULL,								/* On instrument with such ID */
	Quantity			integer NOT NULL CHECK (Quantity>0),					/* Quantity to buy/sell */
	Price				float NOT NULL CHECK (Price>0),							/* At this price */
	Way					varchar(4) NOT NULL,									/* 'Buy' ot 'Sell' */
	Type				varchar(16) NOT NULL,									/* 'Limit' of 'FillOrKill' etc ... */
	TimeStamp 			datetime2 NOT NULL,										/* Creation date */
	Path				varchar(255) NOT NULL,									/* Exemple : /StatArb/Euro/Strategy1/ */

	FOREIGN KEY (DBOrderServiceID) REFERENCES DBOrderService.DBOrderService(ID) ON DELETE CASCADE,
		
	_InsertionStamp							bigint,
	_UpdateStamp							bigint,
);